<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="../common.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html lang="en">
    <head>        
    	<base href="<%=basePath%>">
        <!-- META SECTION -->
        <title>${htmlTitle}</title>            
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        
        <link rel="icon" href="favicon.ico" type="image/x-icon" />
        <!-- END META SECTION -->
    </head>
    <body>
    
    	<%@include file="../header.jsp"%>
    
        <!-- START PAGE CONTAINER -->
        <div class="page-container">
            
            <!-- START PAGE SIDEBAR -->
            	<%@include file="../left.jsp"%>
            <!-- END PAGE SIDEBAR -->
            
            <!-- PAGE CONTENT -->
            <div class="page-content">

                <!-- START BREADCRUMB -->
                <%=request.getAttribute("navigation") %> 
                <!-- END BREADCRUMB -->       
                
                <!-- START CONTENT FRAME -->
				<!-- END  CONTENT FRAME -->                
                
                <!-- PAGE CONTENT WRAPPER -->
                <div class="page-content-wrap">
					<div class="row">
						<div class="col-md-12" style="padding-top: 10px;">
							<!-- START SEARCH -->
							<div class="panel panel-default">
								<div class="panel-body">
									<div class="col-md-12" style="padding-left: 0px;">
										<div class="col-md-3" style="padding-left: 2px;">
											<div class="pull-left" style="line-height:30px;">物业名称</div>
	                                		<div class="input-group" >
	                                           	<div class="input-group-btn">
	                                                 <input id="name" type="text" class="form-control" value=""/>                                      
	                                            </div>
		                                    </div>
										</div>
										<div class="col-md-3" style="padding-left: 2px;">
											<div class="pull-left" style="line-height:30px;">手机号</div>
	                                		<div class="input-group" >
	                                           	<div class="input-group-btn">
	                                                 <input id="tel" type="text" class="form-control" value=""/>                                      
	                                            </div>
		                                    </div>
										</div>
										<div class="col-md-4" >
											<button class="btn btn-primary" onclick="search()">
												<span class="fa"></span>查询
											</button>
											<button class="btn btn-primary" onclick="clearCondition()">
												<span class="fa"></span>清空
											</button>
											<button class="btn btn-primary" onclick="addEstate()">
													<span class="fa"></span>添加
											</button>
										</div>
									</div>
								</div>
							</div>
							<!-- END SEARCH -->
							
							<!-- START SEARCH RESULT -->
							<div class="search-results">
								<!-- START DEFAULT DATATABLE -->
								<div class="panel panel-default">
									<div class="panel-body">
										<table id="tableList" class="table table-hover "
											cellspacing="0" width="100%">
											<thead>
												<tr>
													<th style="width: 10%">
														物业名称
													</th>
													<th style="width: 10%">
														法人代表
													</th>
													<th style="width: 10%">
														身份证号
													</th>
													<th style="width: 10%">
														手机号
													</th>
													<th style="width: 10%">
														收款银行
													</th>
													<th style="width: 10%">
														收款分行
													</th>
													<th style="width: 10%">
														银行卡号
													</th>
													<th style="width: 10%">
														停车场数量
													</th>
													<th style="width: 20%">
														操作
													</th>
												</tr>
											</thead>
										</table>
									</div>
								</div>
								<!-- END DEFAULT DATATABLE -->
							</div>
						</div>
					</div>
                </div>
                <!-- END PAGE CONTENT WRAPPER -->                                
            </div>            
            <!-- END PAGE CONTENT -->
        </div>
        <!-- END PAGE CONTAINER -->
        
        <script type="text/javascript">
        	var table;
        	$(document).ready(function() {
        		queryList();
			});
        	
        	function search()
		 	{
		 		table.ajax.reload();
		 	}
        	
        	function queryList() {
        		table = $('#tableList').DataTable({
					processing :true,
					serverSide :true,
					bSort :false,
					bFilter :false, //过滤功能
					bAutoWidth: false,//自动宽度
					ajax : {
						"url" :ctx + "/estate/queryEstateList",
						"type" :"POST",
						"data": function(d){
						    return $.extend({}, d, {
						        "name": $("#name").val(),
						        "tel": $("#tel").val()
						      });
						    }
					},
					columns : [
							{
								"data" :"name"
							}, {
								"data" :"legalPerson"
							}, {
								"data" :"cardNo"
							}, {
								"data" :"tel"
							}, {
								"data" :"dueBank"
							}, {
								"data" :"subbranch"
							}, {
								"data" :"account"
							}, {
								"mDataProp": null 
							}, { 
								"mDataProp": null 
							}
						],
				columnDefs: [
								{
								    targets: 7,
								    render: function (a, b, c, d) {
								        return "...";
								    }
								},
				                {
				                    targets: 8,
				                    render: function (a, b, c, d) {
				                        return "<a class=\"btn btn-info actionBtn\" href=\"javascript:void(0)\" onclick=\"edit(\'" + c.id + "\')\"><i class=\"glyphicon glyphicon-edit icon-white\"></i>修改 </a>"
				                        	+"&nbsp;<a  class=\"btn btn-success actionBtn\" href=\"javascript:void(0)\" onclick=\"wechatEdit(\'" + c.id + "\')\">  <i class=\"fa fa-edit icon-white\"></i>支付 </a>";
						                        //+"&nbsp;&nbsp;" 
						                        //+ "<a class=\"btn btn-success actionBtn\" href=\"javascript:void(0)\" onclick=\"promptMsg(\'" + c.id + "\')\"><i class=\"glyphicon glyphicon-zoom-in icon-white\"></i> 提示语 </a>";
				                    }
				                }
				            ],
					"language" : {
						"lengthMenu" :"_MENU_ 条记录每页",
						"zeroRecords" :"没有找到记录",
						"info" :"第 _PAGE_ 页 ( 总共 _PAGES_ 页 )",
						"infoEmpty" :"无记录",
						"infoFiltered" :"(从 _MAX_ 条记录过滤)",
						"paginate" : {
							 "first":"首页",  
							 "last":"末页",     
							"previous" :"上一页",
							"next" :"下一页"
						}
					},
					"sPaginationType": "full_numbers"
				});
        	}
        	
        	function clearCondition()
		 	{
		 		$("#name").val("");
		 		$("#tel").val("");
		 	}
        	
        	function addEstate() {
        		var menuId = '${currMenuId}';
        		window.location.href = ctx + "/estate/editEstate?menuId=" + menuId;
        	}
        	
        	function edit(id) {
        		var menuId = '${currMenuId}';
        		window.location.href = ctx + "/estate/editEstate?id="+id+"&menuId=" + menuId;
        	}
        	
        	function wechatEdit(estateId) {
        		var menuId = '${currMenuId}';
        		window.location.href = ctx + "/estate/editEstateWechat?estateId="+estateId+"&menuId=" + menuId;
        	}
        	
        </script>
        
        
    </body>
</html>